<?php

namespace Part08_FactoryMethodModel\Code2;

require_once '../../autoload.php';

$numA = $_POST['numA'];
$numB = $_POST['numB'];
if (!$numA || !$numB) {
    echo '缺少必要参数';
    die;
}
$opeObj = AddFactory::CreateOperation();
$opeObj->setNumA($numA);
$opeObj->setNumB($numB);
try {
    $result = $opeObj->getResult();
    echo "结果是" . $result;
} catch (\Exception $e) {
    echo 'catch 异常：'.$e->getMessage();
}